package ${package}.bean;

import com.njzxw.fs.commonutil.annotation.ValidInsert;
import com.njzxw.fs.commonutil.annotation.ValidUpdate;
import com.njzxw.fs.commonutil.bean.BaseBean;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.*;
import java.util.List;

@Setter
@Getter
@ToString(callSuper = true)
public class ${className}Bean extends BaseBean {

    <#list colimnList as p>
    <#if p.COLUMN_NAME != 'oper_id' >
    <#if p.COLUMN_NAME != 'oper_date' >
    @ValidInsert
    @ValidUpdate
    </#if>
    <#if p.IS_NULLABLE == 1 >
    <#if p.DATA_TYPE == 'String' >
    @NotBlank(message = "${p.COLUMN_COMMENT}不可为空",groups={Insert.class,Update.class,Save.class})
    <#else>
    @NotNull(message = "${p.COLUMN_COMMENT}不可为空",groups={Insert.class,Update.class,Save.class})
    </#if>
    </#if>
    <#if p.DATA_TYPE='Integer' >
    @Pattern(regexp = "((\\-|\\+)?\\d+(\\.\\d+)?)|(\\s*)",message = "${p.COLUMN_COMMENT}必须为数字或为空",groups={Insert.class,Update.class,Delete.class,QueryPage.class,Save.class})
    </#if>
    <#if p.CHARACTER_MAXIMUM_LENGTH?? >
    @Size(max = ${p.CHARACTER_MAXIMUM_LENGTH},min = 0,message = "${p.COLUMN_COMMENT}最大长度不能超过${p.CHARACTER_MAXIMUM_LENGTH}",groups={Insert.class,Update.class,Delete.class,QueryPage.class,Save.class})
    </#if>
    public String ${p.COLUMN_NAME};

    <#if p.is_date = 1 >
    public ${p.DATA_TYPE} max_${p.COLUMN_NAME};

    public ${p.DATA_TYPE} min_${p.COLUMN_NAME};
    </#if>
    </#if>
    </#list>

    public interface Insert{}

    public interface Update{}

    public interface Delete{}

    public interface QueryPage{}

    public interface QueryId{}

    public interface Save{}

}